#-*- coding: UTF-8 -*-
from pyramid.httpexceptions import HTTPFound
from pyramid.security import remember
from pyramid.security import forget



from scp.modelo.models import DBSession
from scp.modelo.Usuario import Usuario

from pyramid.response import Response
from pyramid.view import view_config
import json

from pyramid.security import authenticated_userid
from pyramid.httpexceptions import HTTPForbidden

import json

#@view_config(renderer='json')
def home(request):
	
	login = authenticated_userid(request)
	
	print 'esto es loginnnnnnnn!!!!!'
	print login
	
	if login is None:
		print 'No estás logeadoooooooo!!!!'
		#return HTTPForbidden()
		loc = request.route_url('login', _query=(('next', request.path),))
		return HTTPFound(location=loc)
	
	
	#return {'logged_in': login, 'json': {'hola': 'hola', 'mundo': 'mundo'}}
	return dict(
        logged_in = login,
        ocultar =  json.dumps(dict( sistema = False, crearUsuario = False,mundo = 'mundo',)),
        )
	
	
	
	
